//package com.hzncc.scaffold.controller.Common;
//
//import cn.hutool.core.util.URLUtil;
//import com.hzncc.scaffold.core.ResultT;
//import com.hzncc.scaffold.service.ISysFileService;
//import com.hzncc.scaffold.utils.FileUtil;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.apache.commons.lang3.ObjectUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.mock.web.MockMultipartFile;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.io.IOException;
//import java.io.InputStream;
//
//
///**
// * @author DrunkBear
// */
//@RestController
//@RequestMapping("/system/file")
//@Api(tags = "Minio文件上传")
//public class SysFileController{
//
//    @Autowired
//    private ISysFileService sysFileService;
//
//    /**
//     * 图片上传minio
//     *
//     * @param file 图片文件
//     * @return 返回
//     */
//    @PostMapping("/upload")
//    @ApiOperation("图片上传")
//    public ResultT uploadFileMinio(MultipartFile file) {
//        String url = sysFileService.uploadFileMinio(file);
//        if (StringUtils.isNotEmpty(url)) {
//            return ResultT.success(url);
//        }
//        return ResultT.fail("上传失败！");
//    }
//
//
//    @PostMapping("/cast")
//    @ApiOperation("文件转换")
//    public ResultT cast(String fileName) throws IOException {
//        String newFileName = "http://106.14.189.64:3005/public/upload/img/" + fileName;
//
//        InputStream stream = FileUtil.getInputStreamByUrl(newFileName);
//        if (!ObjectUtils.isEmpty(stream)) {
//            MultipartFile file = new MockMultipartFile(newFileName,fileName,"", stream);
//            String url = sysFileService.uploadFileMinio(file);
//            return ResultT.success(url);
//        }else {
//            return ResultT.fail();
//        }
//    }
//}
